import Vue from 'vue'
import { configRouter } from './route-config'
import VueRouter from 'vue-router'
import VueResource from 'vue-resource'
import lazyload from 'vue-lazyload'

Vue.use(VueRouter);
Vue.use(VueResource);

Vue.config.devtools = true

Vue.use(lazyload, {
  loading: require('../static/loading.gif'),
})

Vue.http.options.root = '/vue/mshop'

Vue.http.interceptors.push({
    request: (request) => {
        console.log('Request Catch:', request.url, request);
        return request;
    },

    response: (response) => {
        console.log('Response Catch:', response.request.url, response);
        return response;
    }
});

const router = new VueRouter({
  saveScrollPosition: true
});

configRouter(router);

const App = Vue.extend(require('./App.vue'));

router.start(App, '#app');
